<html>
    <head>
        <title></title>
    </head>

    <body>

        <script>

            var Factory = function(type, content) {
                var o = new this[type] (content);
                return o;
            }

            Factory.prototype = {
                Java :function(content) {
                    this.content =content;
                    (function(content) {
                        console.error(content);
                    })(content);
                },
                JavaScript :function(content) {
                    this.content =content;
                    (function(content) {
                        console.error(content);
                    })(content);
                },
                PHP : function(content) {
                    this.content =content;
                    (function(content) {
                        console.error(content);
                    })(content);
                }
            }

            var test = new Factory('Java', 'Java 方法');

            

        </script>

    </body>
</html>